$OpenBSD: patch-Makerules,v 1.13 2015/04/25 23:04:54 sthen Exp $
--- Makerules.orig	Thu Apr 16 09:57:45 2015
+++ Makerules	Sat Apr 25 23:31:58 2015
@@ -7,6 +7,7 @@ OS := $(OS:Darwin=MACOS)
 
 CFLAGS += -Wall
 
+ifneq "$(OS)" "OpenBSD" # don't override C optimizer flags for ports builds
 ifeq "$(build)" "debug"
 CFLAGS += -pipe -g -DDEBUG
 else ifeq "$(build)" "profile"
@@ -24,6 +25,7 @@ CFLAGS += -pipe -g -DMEMENTO -DDEBUG
 else
 $(error unknown build setting: '$(build)')
 endif
+endif
 
 # Windows (MINGW) build doesn't use system libraries.
 ifeq "$(OS)" "MINGW"
@@ -54,7 +56,7 @@ LD = xcrun ld
 RANLIB_CMD = xcrun ranlib $@
 
 # Linux uses pkg-config for system libraries.
-else ifeq "$(OS)" "Linux"
+else
 
 HAVE_X11 ?= yes
 
@@ -68,12 +70,12 @@ HAVE_CURL = yes
 SYS_CURL_CFLAGS = $(shell pkg-config --cflags libcurl)
 SYS_CURL_LIBS = $(shell pkg-config --libs libcurl)
 endif
-SYS_CURL_DEPS = -lpthread -lrt
+SYS_CURL_DEPS = -lpthread
 
 SYS_X11_CFLAGS = $(shell pkg-config --cflags x11 xext)
 SYS_X11_LIBS = $(shell pkg-config --libs x11 xext)
 
-SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2)
+SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2) -I/usr/local/include
 SYS_FREETYPE_LIBS = $(shell pkg-config --libs freetype2)
 SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjp2)
 SYS_OPENJPEG_LIBS = $(shell pkg-config --libs libopenjp2)
